{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "几个股票的涨跌——有相关性——线性相关？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tushare as ts\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import statsmodels.api as sm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "pro=ts.pro_api()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ts_code</th>\n",
       "      <th>trade_date</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>pre_close</th>\n",
       "      <th>change</th>\n",
       "      <th>pct_chg</th>\n",
       "      <th>vol</th>\n",
       "      <th>amount</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190815</td>\n",
       "      <td>8.51</td>\n",
       "      <td>8.73</td>\n",
       "      <td>8.37</td>\n",
       "      <td>8.67</td>\n",
       "      <td>8.71</td>\n",
       "      <td>-0.04</td>\n",
       "      <td>-0.4592</td>\n",
       "      <td>12550.53</td>\n",
       "      <td>10778.198</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190814</td>\n",
       "      <td>8.79</td>\n",
       "      <td>8.83</td>\n",
       "      <td>8.68</td>\n",
       "      <td>8.71</td>\n",
       "      <td>8.69</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.2301</td>\n",
       "      <td>6898.75</td>\n",
       "      <td>6026.758</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190813</td>\n",
       "      <td>8.73</td>\n",
       "      <td>8.76</td>\n",
       "      <td>8.66</td>\n",
       "      <td>8.69</td>\n",
       "      <td>8.82</td>\n",
       "      <td>-0.13</td>\n",
       "      <td>-1.4739</td>\n",
       "      <td>9299.77</td>\n",
       "      <td>8092.306</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190812</td>\n",
       "      <td>8.74</td>\n",
       "      <td>8.89</td>\n",
       "      <td>8.69</td>\n",
       "      <td>8.82</td>\n",
       "      <td>8.74</td>\n",
       "      <td>0.08</td>\n",
       "      <td>0.9153</td>\n",
       "      <td>8123.61</td>\n",
       "      <td>7116.566</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190809</td>\n",
       "      <td>8.78</td>\n",
       "      <td>8.85</td>\n",
       "      <td>8.65</td>\n",
       "      <td>8.74</td>\n",
       "      <td>8.73</td>\n",
       "      <td>0.01</td>\n",
       "      <td>0.1145</td>\n",
       "      <td>10461.00</td>\n",
       "      <td>9143.974</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190808</td>\n",
       "      <td>8.64</td>\n",
       "      <td>8.81</td>\n",
       "      <td>8.64</td>\n",
       "      <td>8.73</td>\n",
       "      <td>8.63</td>\n",
       "      <td>0.10</td>\n",
       "      <td>1.1587</td>\n",
       "      <td>8754.50</td>\n",
       "      <td>7640.938</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190807</td>\n",
       "      <td>8.78</td>\n",
       "      <td>8.80</td>\n",
       "      <td>8.63</td>\n",
       "      <td>8.63</td>\n",
       "      <td>8.69</td>\n",
       "      <td>-0.06</td>\n",
       "      <td>-0.6904</td>\n",
       "      <td>9081.50</td>\n",
       "      <td>7914.696</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190806</td>\n",
       "      <td>8.73</td>\n",
       "      <td>8.85</td>\n",
       "      <td>8.60</td>\n",
       "      <td>8.69</td>\n",
       "      <td>8.90</td>\n",
       "      <td>-0.21</td>\n",
       "      <td>-2.3596</td>\n",
       "      <td>20031.66</td>\n",
       "      <td>17433.940</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190805</td>\n",
       "      <td>9.00</td>\n",
       "      <td>9.04</td>\n",
       "      <td>8.87</td>\n",
       "      <td>8.90</td>\n",
       "      <td>8.93</td>\n",
       "      <td>-0.03</td>\n",
       "      <td>-0.3359</td>\n",
       "      <td>10291.50</td>\n",
       "      <td>9208.161</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190802</td>\n",
       "      <td>9.03</td>\n",
       "      <td>9.03</td>\n",
       "      <td>8.80</td>\n",
       "      <td>8.93</td>\n",
       "      <td>9.12</td>\n",
       "      <td>-0.19</td>\n",
       "      <td>-2.0833</td>\n",
       "      <td>11517.25</td>\n",
       "      <td>10321.057</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190801</td>\n",
       "      <td>9.00</td>\n",
       "      <td>9.15</td>\n",
       "      <td>8.95</td>\n",
       "      <td>9.12</td>\n",
       "      <td>9.04</td>\n",
       "      <td>0.08</td>\n",
       "      <td>0.8850</td>\n",
       "      <td>11221.25</td>\n",
       "      <td>10188.811</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190731</td>\n",
       "      <td>9.15</td>\n",
       "      <td>9.15</td>\n",
       "      <td>9.01</td>\n",
       "      <td>9.04</td>\n",
       "      <td>9.15</td>\n",
       "      <td>-0.11</td>\n",
       "      <td>-1.2022</td>\n",
       "      <td>12338.94</td>\n",
       "      <td>11172.575</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190730</td>\n",
       "      <td>9.22</td>\n",
       "      <td>9.35</td>\n",
       "      <td>9.11</td>\n",
       "      <td>9.15</td>\n",
       "      <td>9.25</td>\n",
       "      <td>-0.10</td>\n",
       "      <td>-1.0811</td>\n",
       "      <td>22501.00</td>\n",
       "      <td>20699.634</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190729</td>\n",
       "      <td>8.92</td>\n",
       "      <td>9.75</td>\n",
       "      <td>8.88</td>\n",
       "      <td>9.25</td>\n",
       "      <td>8.92</td>\n",
       "      <td>0.33</td>\n",
       "      <td>3.6996</td>\n",
       "      <td>42511.81</td>\n",
       "      <td>39744.733</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190726</td>\n",
       "      <td>8.83</td>\n",
       "      <td>8.94</td>\n",
       "      <td>8.83</td>\n",
       "      <td>8.92</td>\n",
       "      <td>8.90</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.2247</td>\n",
       "      <td>6439.00</td>\n",
       "      <td>5725.435</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190725</td>\n",
       "      <td>8.79</td>\n",
       "      <td>9.00</td>\n",
       "      <td>8.79</td>\n",
       "      <td>8.90</td>\n",
       "      <td>8.89</td>\n",
       "      <td>0.01</td>\n",
       "      <td>0.1125</td>\n",
       "      <td>7992.75</td>\n",
       "      <td>7113.477</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190724</td>\n",
       "      <td>8.80</td>\n",
       "      <td>8.94</td>\n",
       "      <td>8.74</td>\n",
       "      <td>8.89</td>\n",
       "      <td>8.73</td>\n",
       "      <td>0.16</td>\n",
       "      <td>1.8328</td>\n",
       "      <td>10586.23</td>\n",
       "      <td>9395.871</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190723</td>\n",
       "      <td>8.60</td>\n",
       "      <td>8.79</td>\n",
       "      <td>8.60</td>\n",
       "      <td>8.73</td>\n",
       "      <td>8.66</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0.8083</td>\n",
       "      <td>8726.00</td>\n",
       "      <td>7615.044</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190722</td>\n",
       "      <td>8.90</td>\n",
       "      <td>8.95</td>\n",
       "      <td>8.62</td>\n",
       "      <td>8.66</td>\n",
       "      <td>8.89</td>\n",
       "      <td>-0.23</td>\n",
       "      <td>-2.5872</td>\n",
       "      <td>13042.62</td>\n",
       "      <td>11387.093</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190719</td>\n",
       "      <td>8.84</td>\n",
       "      <td>8.99</td>\n",
       "      <td>8.84</td>\n",
       "      <td>8.89</td>\n",
       "      <td>8.82</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0.7937</td>\n",
       "      <td>6431.00</td>\n",
       "      <td>5740.798</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190718</td>\n",
       "      <td>9.01</td>\n",
       "      <td>9.01</td>\n",
       "      <td>8.82</td>\n",
       "      <td>8.82</td>\n",
       "      <td>9.02</td>\n",
       "      <td>-0.20</td>\n",
       "      <td>-2.2173</td>\n",
       "      <td>15105.50</td>\n",
       "      <td>13415.785</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190717</td>\n",
       "      <td>9.04</td>\n",
       "      <td>9.14</td>\n",
       "      <td>8.98</td>\n",
       "      <td>9.02</td>\n",
       "      <td>9.05</td>\n",
       "      <td>-0.03</td>\n",
       "      <td>-0.3315</td>\n",
       "      <td>15277.00</td>\n",
       "      <td>13784.043</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190716</td>\n",
       "      <td>9.05</td>\n",
       "      <td>9.15</td>\n",
       "      <td>8.98</td>\n",
       "      <td>9.05</td>\n",
       "      <td>9.04</td>\n",
       "      <td>0.01</td>\n",
       "      <td>0.1106</td>\n",
       "      <td>10122.00</td>\n",
       "      <td>9175.168</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>002758.SZ</td>\n",
       "      <td>20190715</td>\n",
       "      <td>9.09</td>\n",
       "      <td>9.17</td>\n",
       "      <td>8.85</td>\n",
       "      <td>9.04</td>\n",
       "      <td>9.19</td>\n",
       "      <td>-0.15</td>\n",
       "      <td>-1.6322</td>\n",
       "      <td>21086.46</td>\n",
       "      <td>18942.928</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      ts_code trade_date  open  high   low  close  pre_close  change  pct_chg  \\\n",
       "0   002758.SZ   20190815  8.51  8.73  8.37   8.67       8.71   -0.04  -0.4592   \n",
       "1   002758.SZ   20190814  8.79  8.83  8.68   8.71       8.69    0.02   0.2301   \n",
       "2   002758.SZ   20190813  8.73  8.76  8.66   8.69       8.82   -0.13  -1.4739   \n",
       "3   002758.SZ   20190812  8.74  8.89  8.69   8.82       8.74    0.08   0.9153   \n",
       "4   002758.SZ   20190809  8.78  8.85  8.65   8.74       8.73    0.01   0.1145   \n",
       "5   002758.SZ   20190808  8.64  8.81  8.64   8.73       8.63    0.10   1.1587   \n",
       "6   002758.SZ   20190807  8.78  8.80  8.63   8.63       8.69   -0.06  -0.6904   \n",
       "7   002758.SZ   20190806  8.73  8.85  8.60   8.69       8.90   -0.21  -2.3596   \n",
       "8   002758.SZ   20190805  9.00  9.04  8.87   8.90       8.93   -0.03  -0.3359   \n",
       "9   002758.SZ   20190802  9.03  9.03  8.80   8.93       9.12   -0.19  -2.0833   \n",
       "10  002758.SZ   20190801  9.00  9.15  8.95   9.12       9.04    0.08   0.8850   \n",
       "11  002758.SZ   20190731  9.15  9.15  9.01   9.04       9.15   -0.11  -1.2022   \n",
       "12  002758.SZ   20190730  9.22  9.35  9.11   9.15       9.25   -0.10  -1.0811   \n",
       "13  002758.SZ   20190729  8.92  9.75  8.88   9.25       8.92    0.33   3.6996   \n",
       "14  002758.SZ   20190726  8.83  8.94  8.83   8.92       8.90    0.02   0.2247   \n",
       "15  002758.SZ   20190725  8.79  9.00  8.79   8.90       8.89    0.01   0.1125   \n",
       "16  002758.SZ   20190724  8.80  8.94  8.74   8.89       8.73    0.16   1.8328   \n",
       "17  002758.SZ   20190723  8.60  8.79  8.60   8.73       8.66    0.07   0.8083   \n",
       "18  002758.SZ   20190722  8.90  8.95  8.62   8.66       8.89   -0.23  -2.5872   \n",
       "19  002758.SZ   20190719  8.84  8.99  8.84   8.89       8.82    0.07   0.7937   \n",
       "20  002758.SZ   20190718  9.01  9.01  8.82   8.82       9.02   -0.20  -2.2173   \n",
       "21  002758.SZ   20190717  9.04  9.14  8.98   9.02       9.05   -0.03  -0.3315   \n",
       "22  002758.SZ   20190716  9.05  9.15  8.98   9.05       9.04    0.01   0.1106   \n",
       "23  002758.SZ   20190715  9.09  9.17  8.85   9.04       9.19   -0.15  -1.6322   \n",
       "\n",
       "         vol     amount  \n",
       "0   12550.53  10778.198  \n",
       "1    6898.75   6026.758  \n",
       "2    9299.77   8092.306  \n",
       "3    8123.61   7116.566  \n",
       "4   10461.00   9143.974  \n",
       "5    8754.50   7640.938  \n",
       "6    9081.50   7914.696  \n",
       "7   20031.66  17433.940  \n",
       "8   10291.50   9208.161  \n",
       "9   11517.25  10321.057  \n",
       "10  11221.25  10188.811  \n",
       "11  12338.94  11172.575  \n",
       "12  22501.00  20699.634  \n",
       "13  42511.81  39744.733  \n",
       "14   6439.00   5725.435  \n",
       "15   7992.75   7113.477  \n",
       "16  10586.23   9395.871  \n",
       "17   8726.00   7615.044  \n",
       "18  13042.62  11387.093  \n",
       "19   6431.00   5740.798  \n",
       "20  15105.50  13415.785  \n",
       "21  15277.00  13784.043  \n",
       "22  10122.00   9175.168  \n",
       "23  21086.46  18942.928  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_HTYY=pro.daily(ts_code=\"002758.SZ\", start_date=\"20190715\",end_date=\"20190815\")\n",
    "df_HTYY"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_HTYY_pct_change=df_HTYY[\"pct_chg\"].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-0.4592,  0.2301, -1.4739,  0.9153,  0.1145,  1.1587, -0.6904,\n",
       "       -2.3596, -0.3359, -2.0833,  0.885 , -1.2022, -1.0811,  3.6996,\n",
       "        0.2247,  0.1125,  1.8328,  0.8083, -2.5872,  0.7937, -2.2173,\n",
       "       -0.3315,  0.1106, -1.6322])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_HTYY_pct_change"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_DYYY=pro.daily(ts_code=\"600833.SH\", start_date=\"20190715\",end_date=\"20190815\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_DYYY_pct_change=df_DYYY[\"pct_chg\"].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.1073,  0.8658, -1.3874,  1.7372, -2.4364,  1.6146, -1.2752,\n",
       "       -4.7571, -1.002 , -1.0902,  0.    ,  1.3052,  0.8097, -0.9027,\n",
       "        1.1156, -0.404 ,  1.5385,  0.9317, -2.2267, -0.1011, -1.1   ,\n",
       "       -0.6951, -0.8858,  0.8937])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_DYYY_pct_change"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.    , -0.4592],\n",
       "       [ 1.    ,  0.2301],\n",
       "       [ 1.    , -1.4739],\n",
       "       [ 1.    ,  0.9153],\n",
       "       [ 1.    ,  0.1145],\n",
       "       [ 1.    ,  1.1587],\n",
       "       [ 1.    , -0.6904],\n",
       "       [ 1.    , -2.3596],\n",
       "       [ 1.    , -0.3359],\n",
       "       [ 1.    , -2.0833],\n",
       "       [ 1.    ,  0.885 ],\n",
       "       [ 1.    , -1.2022],\n",
       "       [ 1.    , -1.0811],\n",
       "       [ 1.    ,  3.6996],\n",
       "       [ 1.    ,  0.2247],\n",
       "       [ 1.    ,  0.1125],\n",
       "       [ 1.    ,  1.8328],\n",
       "       [ 1.    ,  0.8083],\n",
       "       [ 1.    , -2.5872],\n",
       "       [ 1.    ,  0.7937],\n",
       "       [ 1.    , -2.2173],\n",
       "       [ 1.    , -0.3315],\n",
       "       [ 1.    ,  0.1106],\n",
       "       [ 1.    , -1.6322]])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_df_HTYY_pct_change=sm.add_constant(df_HTYY_pct_change)\n",
    "X_df_HTYY_pct_change"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                            OLS Regression Results                            \n",
      "==============================================================================\n",
      "Dep. Variable:                      y   R-squared:                       0.197\n",
      "Model:                            OLS   Adj. R-squared:                  0.160\n",
      "Method:                 Least Squares   F-statistic:                     5.395\n",
      "Date:                Thu, 22 Aug 2019   Prob (F-statistic):             0.0298\n",
      "Time:                        00:11:54   Log-Likelihood:                -41.266\n",
      "No. Observations:                  24   AIC:                             86.53\n",
      "Df Residuals:                      22   BIC:                             88.89\n",
      "Df Model:                           1                                         \n",
      "Covariance Type:            nonrobust                                         \n",
      "==============================================================================\n",
      "                 coef    std err          t      P>|t|      [0.025      0.975]\n",
      "------------------------------------------------------------------------------\n",
      "const         -0.1985      0.292     -0.681      0.503      -0.803       0.406\n",
      "x1             0.4633      0.199      2.323      0.030       0.050       0.877\n",
      "==============================================================================\n",
      "Omnibus:                        3.207   Durbin-Watson:                   2.312\n",
      "Prob(Omnibus):                  0.201   Jarque-Bera (JB):                2.025\n",
      "Skew:                          -0.706   Prob(JB):                        0.363\n",
      "Kurtosis:                       3.182   Cond. No.                         1.51\n",
      "==============================================================================\n",
      "\n",
      "Warnings:\n",
      "[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n"
     ]
    }
   ],
   "source": [
    "results=sm.OLS(df_DYYY_pct_change,X_df_HTYY_pct_change).fit()\n",
    "print(results.summary())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-0.41127132, -0.0919402 , -0.88135007,  0.22549151, -0.14549406,\n",
       "        0.33825112, -0.51837904, -1.29166716, -0.35415028, -1.16366601,\n",
       "        0.21145447, -0.75547996, -0.69937812,  1.51537056, -0.09444185,\n",
       "       -0.1464206 ,  0.65054055,  0.17592176, -1.39710711,  0.16915804,\n",
       "       -1.22574402, -0.3521119 , -0.14730081, -0.9546855 ])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fitted_ys=results.fittedvalues\n",
    "fitted_ys"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x2767794a4a8>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAlUAAAFpCAYAAAC1Vt35AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3Xt8VdWd9/HvjxhJqGAe7yYRYRRTUSqhsRcRBcSCN25Wq76q0j4OtupUWxuVMlqrVRyD4zMztlqqjjrD6KMVgncqoqNVqwaDRsRYvJJgFRm5lSAhWfPHTggHzslJOOucffY5n/frlZdk75V9fhwVvmet317bnHMCAABAavqEXQAAAEAuIFQBAAB4QKgCAADwgFAFAADgAaEKAADAA0IVAACAB4QqAAAADwhVAAAAHhCqAAAAPEg5VJnZQWb2rJktN7NlZnapj8IAAACixFJ9TI2ZHSjpQOfc62bWX9ISSZOdc28n+pl99tnHDRo0KKXXBQAAyIQlS5Z87pzbN9m43VJ9IefcJ5I+6fj1BjNbLqlMUsJQNWjQINXV1aX60gAAAGlnZh/1ZJzXniozGySpUtIrcc5NN7M6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MlnSrpBMfeF3Elew+xS5okHbTd9+WSVoVUC/KUmRUqCFRznXPzwq4nypxza83sOQV9foSqnhkpaaKZnSypSNIAM/tP59z3u/shlv+ylJlNkHSlpInOuU1h14O88pqkIWY22Mx2l3SWpEdCrgl5xMxM0l2Sljvn/jnseqLIzPbtvGvczIoljZP0TrhVRYdzboZzrtw5N0jBn4GLkwUqiVCVzW6T1F/S02a21MzuCLugqDGzKWbWJOnbkh43s4Vh1xQFHTdIXCJpoYIG4Qedc8vCrSpazOx+SS9LqjCzJjP7v2HXFDEjJZ0raWzHn39LO2YM0HMHSnrWzN5U8EHpaedcj7YFwK5jR3UAAAAPmKkCAADwgFAFAADgAaEKAADAA0IVAACAB4QqAAAADwhVAAAAHhCqAAAAPCBUAQAAePC/myw51u+tEUUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 720x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax=plt.subplots(figsize=(10,6))\n",
    "ax.plot(df_HTYY_pct_change,df_DYYY_pct_change,\"o\",label=\"data\")\n",
    "ax.plot(df_HTYY_pct_change,fitted_ys,\"r--\",label=\"OLS\")\n",
    "ax.legend()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
